home *** CD-ROM | disk | FTP | other *** search
- package sun.font;
-
- import java.awt.Font;
- import java.awt.Paint;
- import java.awt.Toolkit;
- import java.awt.font.GraphicAttribute;
- import java.awt.font.NumericShaper;
- import java.awt.font.TextAttribute;
- import java.awt.font.TransformAttribute;
- import java.awt.geom.AffineTransform;
- import java.awt.geom.NoninvertibleTransformException;
- import java.awt.geom.Point2D;
- import java.awt.im.InputMethodHighlight;
- import java.io.Serializable;
- import java.text.Annotation;
- import java.text.AttributedCharacterIterator;
- import java.util.HashMap;
- import java.util.Hashtable;
- import java.util.Map;
- import sun.font.AttributeValues.1;
-
- public final class AttributeValues implements Cloneable {
- private int defined;
- private int nondefault;
- private String family = "Default";
- private float weight = 1.0F;
- private float width = 1.0F;
- private float posture;
- private float size = 12.0F;
- private float tracking;
- private NumericShaper numericShaping;
- private AffineTransform transform;
- private GraphicAttribute charReplacement;
- private Paint foreground;
- private Paint background;
- private float justification = 1.0F;
- private Object imHighlight;
- private Font font;
- private byte imUnderline = -1;
- private byte superscript;
- private byte underline = -1;
- private byte runDirection = -2;
- private byte bidiEmbedding;
- private byte kerning;
- private byte ligatures;
- private boolean strikethrough;
- private boolean swapColors;
- private AffineTransform baselineTransform;
- private AffineTransform charTransform;
- private static final AttributeValues DEFAULT = new AttributeValues();
- public static final int MASK_ALL = getMask((EAttribute[])EAttribute.class.getEnumConstants());
- private static final String DEFINED_KEY = "sun.font.attributevalues.defined_key";
-
- public String getFamily() {
- return this.family;
- }
-
- public void setFamily(String var1) {
- this.family = var1;
- this.update(EAttribute.EFAMILY);
- }
-
- public float getWeight() {
- return this.weight;
- }
-
- public void setWeight(float var1) {
- this.weight = var1;
- this.update(EAttribute.EWEIGHT);
- }
-
- public float getWidth() {
- return this.width;
- }
-
- public void setWidth(float var1) {
- this.width = var1;
- this.update(EAttribute.EWIDTH);
- }
-
- public float getPosture() {
- return this.posture;
- }
-
- public void setPosture(float var1) {
- this.posture = var1;
- this.update(EAttribute.EPOSTURE);
- }
-
- public float getSize() {
- return this.size;
- }
-
- public void setSize(float var1) {
- this.size = var1;
- this.update(EAttribute.ESIZE);
- }
-
- public AffineTransform getTransform() {
- return this.transform;
- }
-
- public void setTransform(AffineTransform var1) {
- this.transform = var1 != null && !var1.isIdentity() ? new AffineTransform(var1) : DEFAULT.transform;
- this.updateDerivedTransforms();
- this.update(EAttribute.ETRANSFORM);
- }
-
- public void setTransform(TransformAttribute var1) {
- this.transform = var1 != null && !var1.isIdentity() ? var1.getTransform() : DEFAULT.transform;
- this.updateDerivedTransforms();
- this.update(EAttribute.ETRANSFORM);
- }
-
- public int getSuperscript() {
- return this.superscript;
- }
-
- public void setSuperscript(int var1) {
- this.superscript = (byte)var1;
- this.update(EAttribute.ESUPERSCRIPT);
- }
-
- public Font getFont() {
- return this.font;
- }
-
- public void setFont(Font var1) {
- this.font = var1;
- this.update(EAttribute.EFONT);
- }
-
- public GraphicAttribute getCharReplacement() {
- return this.charReplacement;
- }
-
- public void setCharReplacement(GraphicAttribute var1) {
- this.charReplacement = var1;
- this.update(EAttribute.ECHAR_REPLACEMENT);
- }
-
- public Paint getForeground() {
- return this.foreground;
- }
-
- public void setForeground(Paint var1) {
- this.foreground = var1;
- this.update(EAttribute.EFOREGROUND);
- }
-
- public Paint getBackground() {
- return this.background;
- }
-
- public void setBackground(Paint var1) {
- this.background = var1;
- this.update(EAttribute.EBACKGROUND);
- }
-
- public int getUnderline() {
- return this.underline;
- }
-
- public void setUnderline(int var1) {
- this.underline = (byte)var1;
- this.update(EAttribute.EUNDERLINE);
- }
-
- public boolean getStrikethrough() {
- return this.strikethrough;
- }
-
- public void setStrikethrough(boolean var1) {
- this.strikethrough = var1;
- this.update(EAttribute.ESTRIKETHROUGH);
- }
-
- public int getRunDirection() {
- return this.runDirection;
- }
-
- public void setRunDirection(int var1) {
- this.runDirection = (byte)var1;
- this.update(EAttribute.ERUN_DIRECTION);
- }
-
- public int getBidiEmbedding() {
- return this.bidiEmbedding;
- }
-
- public void setBidiEmbedding(int var1) {
- this.bidiEmbedding = (byte)var1;
- this.update(EAttribute.EBIDI_EMBEDDING);
- }
-
- public float getJustification() {
- return this.justification;
- }
-
- public void setJustification(float var1) {
- this.justification = var1;
- this.update(EAttribute.EJUSTIFICATION);
- }
-
- public Object getInputMethodHighlight() {
- return this.imHighlight;
- }
-
- public void setInputMethodHighlight(Annotation var1) {
- this.imHighlight = var1;
- this.update(EAttribute.EINPUT_METHOD_HIGHLIGHT);
- }
-
- public void setInputMethodHighlight(InputMethodHighlight var1) {
- this.imHighlight = var1;
- this.update(EAttribute.EINPUT_METHOD_HIGHLIGHT);
- }
-
- public int getInputMethodUnderline() {
- return this.imUnderline;
- }
-
- public void setInputMethodUnderline(int var1) {
- this.imUnderline = (byte)var1;
- this.update(EAttribute.EINPUT_METHOD_UNDERLINE);
- }
-
- public boolean getSwapColors() {
- return this.swapColors;
- }
-
- public void setSwapColors(boolean var1) {
- this.swapColors = var1;
- this.update(EAttribute.ESWAP_COLORS);
- }
-
- public NumericShaper getNumericShaping() {
- return this.numericShaping;
- }
-
- public void setNumericShaping(NumericShaper var1) {
- this.numericShaping = var1;
- this.update(EAttribute.ENUMERIC_SHAPING);
- }
-
- public int getKerning() {
- return this.kerning;
- }
-
- public void setKerning(int var1) {
- this.kerning = (byte)var1;
- this.update(EAttribute.EKERNING);
- }
-
- public float getTracking() {
- return this.tracking;
- }
-
- public void setTracking(float var1) {
- this.tracking = (float)((byte)((int)var1));
- this.update(EAttribute.ETRACKING);
- }
-
- public int getLigatures() {
- return this.ligatures;
- }
-
- public void setLigatures(int var1) {
- this.ligatures = (byte)var1;
- this.update(EAttribute.ELIGATURES);
- }
-
- public AffineTransform getBaselineTransform() {
- return this.baselineTransform;
- }
-
- public AffineTransform getCharTransform() {
- return this.charTransform;
- }
-
- public static int getMask(EAttribute var0) {
- return var0.mask;
- }
-
- public static int getMask(EAttribute... var0) {
- int var1 = 0;
-
- for(EAttribute var5 : var0) {
- var1 |= var5.mask;
- }
-
- return var1;
- }
-
- public void unsetDefault() {
- this.defined &= this.nondefault;
- }
-
- public void defineAll(int var1) {
- this.defined |= var1;
- if ((this.defined & EAttribute.EBASELINE_TRANSFORM.mask) != 0) {
- throw new InternalError("can't define derived attribute");
- }
- }
-
- public boolean allDefined(int var1) {
- return (this.defined & var1) == var1;
- }
-
- public boolean anyDefined(int var1) {
- return (this.defined & var1) != 0;
- }
-
- public boolean anyNonDefault(int var1) {
- return (this.nondefault & var1) != 0;
- }
-
- public boolean isDefined(EAttribute var1) {
- return (this.defined & var1.mask) != 0;
- }
-
- public boolean isNonDefault(EAttribute var1) {
- return (this.nondefault & var1.mask) != 0;
- }
-
- public void setDefault(EAttribute var1) {
- if (var1.att == null) {
- throw new InternalError("can't set default derived attribute: " + var1);
- } else {
- this.i_set(var1, DEFAULT);
- this.defined |= var1.mask;
- this.nondefault &= ~var1.mask;
- }
- }
-
- public void unset(EAttribute var1) {
- if (var1.att == null) {
- throw new InternalError("can't unset derived attribute: " + var1);
- } else {
- this.i_set(var1, DEFAULT);
- this.defined &= ~var1.mask;
- this.nondefault &= ~var1.mask;
- }
- }
-
- public void set(EAttribute var1, AttributeValues var2) {
- if (var1.att == null) {
- throw new InternalError("can't set derived attribute: " + var1);
- } else {
- if (var2 != null && var2 != DEFAULT) {
- if ((var2.defined & var1.mask) != 0) {
- this.i_set(var1, var2);
- this.update(var1);
- }
- } else {
- this.setDefault(var1);
- }
-
- }
- }
-
- public void set(EAttribute var1, Object var2) {
- if (var1.att == null) {
- throw new InternalError("can't set derived attribute: " + var1);
- } else {
- if (var2 != null) {
- try {
- this.i_set(var1, var2);
- this.update(var1);
- return;
- } catch (Exception var4) {
- }
- }
-
- this.setDefault(var1);
- }
- }
-
- public Object get(EAttribute var1) {
- if (var1.att == null) {
- throw new InternalError("can't get derived attribute: " + var1);
- } else {
- return (this.nondefault & var1.mask) != 0 ? this.i_get(var1) : null;
- }
- }
-
- public AttributeValues merge(Map<? extends AttributedCharacterIterator.Attribute, ?> var1) {
- return this.merge(var1, MASK_ALL);
- }
-
- public AttributeValues merge(Map<? extends AttributedCharacterIterator.Attribute, ?> var1, int var2) {
- if (var1 instanceof AttributeMap && ((AttributeMap)var1).getValues() != null) {
- this.merge(((AttributeMap)var1).getValues(), var2);
- } else if (var1 != null && !var1.isEmpty()) {
- for(Map.Entry var4 : var1.entrySet()) {
- EAttribute var5 = EAttribute.forAttribute((AttributedCharacterIterator.Attribute)var4.getKey());
- if (var5 != null && (var2 & var5.mask) != 0) {
- this.set(var5, var4.getValue());
- }
- }
- }
-
- return this;
- }
-
- public AttributeValues merge(AttributeValues var1) {
- return this.merge(var1, MASK_ALL);
- }
-
- public AttributeValues merge(AttributeValues var1, int var2) {
- int var3 = var2 & var1.defined;
-
- for(EAttribute var7 : EAttribute.atts) {
- if (var3 == 0) {
- break;
- }
-
- if ((var3 & var7.mask) != 0) {
- var3 &= ~var7.mask;
- this.i_set(var7, var1);
- this.update(var7);
- }
- }
-
- return this;
- }
-
- public static AttributeValues fromMap(Map<? extends AttributedCharacterIterator.Attribute, ?> var0) {
- return fromMap(var0, MASK_ALL);
- }
-
- public static AttributeValues fromMap(Map<? extends AttributedCharacterIterator.Attribute, ?> var0, int var1) {
- return (new AttributeValues()).merge(var0, var1);
- }
-
- public Map<TextAttribute, Object> toMap(Map<TextAttribute, Object> var1) {
- if (var1 == null) {
- var1 = new HashMap();
- }
-
- int var2 = this.defined;
-
- for(int var3 = 0; var2 != 0; ++var3) {
- EAttribute var4 = EAttribute.atts[var3];
- if ((var2 & var4.mask) != 0) {
- var2 &= ~var4.mask;
- var1.put(var4.att, this.get(var4));
- }
- }
-
- return var1;
- }
-
- public static boolean is16Hashtable(Hashtable<Object, Object> var0) {
- return var0.containsKey("sun.font.attributevalues.defined_key");
- }
-
- public static AttributeValues fromSerializableHashtable(Hashtable<Object, Object> var0) {
- AttributeValues var1 = new AttributeValues();
- if (var0 != null && !var0.isEmpty()) {
- for(Map.Entry var3 : var0.entrySet()) {
- Object var4 = var3.getKey();
- Object var5 = var3.getValue();
- if (var4.equals("sun.font.attributevalues.defined_key")) {
- var1.defineAll((Integer)var5);
- } else {
- try {
- EAttribute var6 = EAttribute.forAttribute((AttributedCharacterIterator.Attribute)var4);
- if (var6 != null) {
- var1.set(var6, var5);
- }
- } catch (ClassCastException var7) {
- }
- }
- }
- }
-
- return var1;
- }
-
- public Hashtable<Object, Object> toSerializableHashtable() {
- Hashtable var1 = new Hashtable();
- int var2 = this.defined;
- int var3 = this.defined;
-
- for(int var4 = 0; var3 != 0; ++var4) {
- EAttribute var5 = EAttribute.atts[var4];
- if ((var3 & var5.mask) != 0) {
- var3 &= ~var5.mask;
- Object var6 = this.get(var5);
- if (var6 != null) {
- if (var6 instanceof Serializable) {
- var1.put(var5.att, var6);
- } else {
- var2 &= ~var5.mask;
- }
- }
- }
- }
-
- var1.put("sun.font.attributevalues.defined_key", var2);
- return var1;
- }
-
- public int hashCode() {
- return this.defined << 8 ^ this.nondefault;
- }
-
- public boolean equals(Object var1) {
- try {
- return this.equals((AttributeValues)var1);
- } catch (ClassCastException var3) {
- return false;
- }
- }
-
- public boolean equals(AttributeValues var1) {
- if (var1 == null) {
- return false;
- } else if (var1 == this) {
- return true;
- } else {
- return this.defined == var1.defined && this.nondefault == var1.nondefault && this.underline == var1.underline && this.strikethrough == var1.strikethrough && this.superscript == var1.superscript && this.width == var1.width && this.kerning == var1.kerning && this.tracking == var1.tracking && this.ligatures == var1.ligatures && this.runDirection == var1.runDirection && this.bidiEmbedding == var1.bidiEmbedding && this.swapColors == var1.swapColors && equals(this.transform, var1.transform) && equals(this.foreground, var1.foreground) && equals(this.background, var1.background) && equals(this.numericShaping, var1.numericShaping) && equals(this.justification, var1.justification) && equals(this.charReplacement, var1.charReplacement) && this.size == var1.size && this.weight == var1.weight && this.posture == var1.posture && equals(this.family, var1.family) && equals(this.font, var1.font) && this.imUnderline == var1.imUnderline && equals(this.imHighlight, var1.imHighlight);
- }
- }
-
- public AttributeValues clone() {
- try {
- AttributeValues var1 = (AttributeValues)super.clone();
- if (this.transform != null) {
- var1.transform = new AffineTransform(this.transform);
- var1.updateDerivedTransforms();
- }
-
- return var1;
- } catch (CloneNotSupportedException var2) {
- return null;
- }
- }
-
- public String toString() {
- StringBuilder var1 = new StringBuilder();
- var1.append('{');
- int var2 = this.defined;
-
- for(int var3 = 0; var2 != 0; ++var3) {
- EAttribute var4 = EAttribute.atts[var3];
- if ((var2 & var4.mask) != 0) {
- var2 &= ~var4.mask;
- if (var1.length() > 1) {
- var1.append(", ");
- }
-
- var1.append(var4);
- var1.append('=');
- switch (1.$SwitchMap$sun$font$EAttribute[var4.ordinal()]) {
- case 1:
- var1.append('"');
- var1.append(this.family);
- var1.append('"');
- break;
- case 2:
- var1.append(this.weight);
- break;
- case 3:
- var1.append(this.width);
- break;
- case 4:
- var1.append(this.posture);
- break;
- case 5:
- var1.append(this.size);
- break;
- case 6:
- var1.append(this.transform);
- break;
- case 7:
- var1.append(this.superscript);
- break;
- case 8:
- var1.append(this.font);
- break;
- case 9:
- var1.append(this.charReplacement);
- break;
- case 10:
- var1.append(this.foreground);
- break;
- case 11:
- var1.append(this.background);
- break;
- case 12:
- var1.append(this.underline);
- break;
- case 13:
- var1.append(this.strikethrough);
- break;
- case 14:
- var1.append(this.runDirection);
- break;
- case 15:
- var1.append(this.bidiEmbedding);
- break;
- case 16:
- var1.append(this.justification);
- break;
- case 17:
- var1.append(this.imHighlight);
- break;
- case 18:
- var1.append(this.imUnderline);
- break;
- case 19:
- var1.append(this.swapColors);
- break;
- case 20:
- var1.append(this.numericShaping);
- break;
- case 21:
- var1.append(this.kerning);
- break;
- case 22:
- var1.append(this.ligatures);
- break;
- case 23:
- var1.append(this.tracking);
- break;
- default:
- throw new InternalError();
- }
-
- if ((this.nondefault & var4.mask) == 0) {
- var1.append('*');
- }
- }
- }
-
- var1.append("[btx=" + this.baselineTransform + ", ctx=" + this.charTransform + "]");
- var1.append('}');
- return var1.toString();
- }
-
- private static boolean equals(Object var0, Object var1) {
- return var0 == null ? var1 == null : var0.equals(var1);
- }
-
- private void update(EAttribute var1) {
- this.defined |= var1.mask;
- if (this.i_validate(var1)) {
- if (this.i_equals(var1, DEFAULT)) {
- this.nondefault &= ~var1.mask;
- } else {
- this.nondefault |= var1.mask;
- }
- } else {
- this.setDefault(var1);
- }
-
- }
-
- private void i_set(EAttribute var1, AttributeValues var2) {
- switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
- case 1:
- this.family = var2.family;
- break;
- case 2:
- this.weight = var2.weight;
- break;
- case 3:
- this.width = var2.width;
- break;
- case 4:
- this.posture = var2.posture;
- break;
- case 5:
- this.size = var2.size;
- break;
- case 6:
- this.transform = var2.transform;
- this.updateDerivedTransforms();
- break;
- case 7:
- this.superscript = var2.superscript;
- break;
- case 8:
- this.font = var2.font;
- break;
- case 9:
- this.charReplacement = var2.charReplacement;
- break;
- case 10:
- this.foreground = var2.foreground;
- break;
- case 11:
- this.background = var2.background;
- break;
- case 12:
- this.underline = var2.underline;
- break;
- case 13:
- this.strikethrough = var2.strikethrough;
- break;
- case 14:
- this.runDirection = var2.runDirection;
- break;
- case 15:
- this.bidiEmbedding = var2.bidiEmbedding;
- break;
- case 16:
- this.justification = var2.justification;
- break;
- case 17:
- this.imHighlight = var2.imHighlight;
- break;
- case 18:
- this.imUnderline = var2.imUnderline;
- break;
- case 19:
- this.swapColors = var2.swapColors;
- break;
- case 20:
- this.numericShaping = var2.numericShaping;
- break;
- case 21:
- this.kerning = var2.kerning;
- break;
- case 22:
- this.ligatures = var2.ligatures;
- break;
- case 23:
- this.tracking = var2.tracking;
- break;
- default:
- throw new InternalError();
- }
-
- }
-
- private boolean i_equals(EAttribute var1, AttributeValues var2) {
- switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
- case 1:
- return equals(this.family, var2.family);
- case 2:
- return this.weight == var2.weight;
- case 3:
- return this.width == var2.width;
- case 4:
- return this.posture == var2.posture;
- case 5:
- return this.size == var2.size;
- case 6:
- return equals(this.transform, var2.transform);
- case 7:
- return this.superscript == var2.superscript;
- case 8:
- return equals(this.font, var2.font);
- case 9:
- return equals(this.charReplacement, var2.charReplacement);
- case 10:
- return equals(this.foreground, var2.foreground);
- case 11:
- return equals(this.background, var2.background);
- case 12:
- return this.underline == var2.underline;
- case 13:
- return this.strikethrough == var2.strikethrough;
- case 14:
- return this.runDirection == var2.runDirection;
- case 15:
- return this.bidiEmbedding == var2.bidiEmbedding;
- case 16:
- return this.justification == var2.justification;
- case 17:
- return equals(this.imHighlight, var2.imHighlight);
- case 18:
- return this.imUnderline == var2.imUnderline;
- case 19:
- return this.swapColors == var2.swapColors;
- case 20:
- return equals(this.numericShaping, var2.numericShaping);
- case 21:
- return this.kerning == var2.kerning;
- case 22:
- return this.ligatures == var2.ligatures;
- case 23:
- return this.tracking == var2.tracking;
- default:
- throw new InternalError();
- }
- }
-
- private void i_set(EAttribute var1, Object var2) {
- switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
- case 1:
- this.family = ((String)var2).trim();
- break;
- case 2:
- this.weight = ((Number)var2).floatValue();
- break;
- case 3:
- this.width = ((Number)var2).floatValue();
- break;
- case 4:
- this.posture = ((Number)var2).floatValue();
- break;
- case 5:
- this.size = ((Number)var2).floatValue();
- break;
- case 6:
- if (var2 instanceof TransformAttribute) {
- TransformAttribute var4 = (TransformAttribute)var2;
- if (var4.isIdentity()) {
- this.transform = null;
- } else {
- this.transform = var4.getTransform();
- }
- } else {
- this.transform = new AffineTransform((AffineTransform)var2);
- }
-
- this.updateDerivedTransforms();
- break;
- case 7:
- this.superscript = (byte)(Integer)var2;
- break;
- case 8:
- this.font = (Font)var2;
- break;
- case 9:
- this.charReplacement = (GraphicAttribute)var2;
- break;
- case 10:
- this.foreground = (Paint)var2;
- break;
- case 11:
- this.background = (Paint)var2;
- break;
- case 12:
- this.underline = (byte)(Integer)var2;
- break;
- case 13:
- this.strikethrough = (Boolean)var2;
- break;
- case 14:
- if (var2 instanceof Boolean) {
- this.runDirection = (byte)(TextAttribute.RUN_DIRECTION_LTR.equals(var2) ? 0 : 1);
- } else {
- this.runDirection = (byte)(Integer)var2;
- }
- break;
- case 15:
- this.bidiEmbedding = (byte)(Integer)var2;
- break;
- case 16:
- this.justification = ((Number)var2).floatValue();
- break;
- case 17:
- if (var2 instanceof Annotation) {
- Annotation var3 = (Annotation)var2;
- this.imHighlight = (InputMethodHighlight)var3.getValue();
- } else {
- this.imHighlight = (InputMethodHighlight)var2;
- }
- break;
- case 18:
- this.imUnderline = (byte)(Integer)var2;
- break;
- case 19:
- this.swapColors = (Boolean)var2;
- break;
- case 20:
- this.numericShaping = (NumericShaper)var2;
- break;
- case 21:
- this.kerning = (byte)(Integer)var2;
- break;
- case 22:
- this.ligatures = (byte)(Integer)var2;
- break;
- case 23:
- this.tracking = ((Number)var2).floatValue();
- break;
- default:
- throw new InternalError();
- }
-
- }
-
- private Object i_get(EAttribute var1) {
- switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
- case 1:
- return this.family;
- case 2:
- return this.weight;
- case 3:
- return this.width;
- case 4:
- return this.posture;
- case 5:
- return this.size;
- case 6:
- return this.transform == null ? TransformAttribute.IDENTITY : new TransformAttribute(this.transform);
- case 7:
- return Integer.valueOf(this.superscript);
- case 8:
- return this.font;
- case 9:
- return this.charReplacement;
- case 10:
- return this.foreground;
- case 11:
- return this.background;
- case 12:
- return Integer.valueOf(this.underline);
- case 13:
- return this.strikethrough;
- case 14:
- switch (this.runDirection) {
- case 0:
- return TextAttribute.RUN_DIRECTION_LTR;
- case 1:
- return TextAttribute.RUN_DIRECTION_RTL;
- default:
- return null;
- }
- case 15:
- return Integer.valueOf(this.bidiEmbedding);
- case 16:
- return this.justification;
- case 17:
- return this.imHighlight;
- case 18:
- return Integer.valueOf(this.imUnderline);
- case 19:
- return this.swapColors;
- case 20:
- return this.numericShaping;
- case 21:
- return Integer.valueOf(this.kerning);
- case 22:
- return Integer.valueOf(this.ligatures);
- case 23:
- return this.tracking;
- default:
- throw new InternalError();
- }
- }
-
- private boolean i_validate(EAttribute var1) {
- switch (1.$SwitchMap$sun$font$EAttribute[var1.ordinal()]) {
- case 1:
- if (this.family == null || this.family.length() == 0) {
- this.family = DEFAULT.family;
- }
-
- return true;
- case 2:
- return this.weight > 0.0F && this.weight < 10.0F;
- case 3:
- return this.width >= 0.5F && this.width < 10.0F;
- case 4:
- return this.posture >= -1.0F && this.posture <= 1.0F;
- case 5:
- return this.size >= 0.0F;
- case 6:
- if (this.transform != null && this.transform.isIdentity()) {
- this.transform = DEFAULT.transform;
- }
-
- return true;
- case 7:
- return this.superscript >= -7 && this.superscript <= 7;
- case 8:
- return true;
- case 9:
- return true;
- case 10:
- return true;
- case 11:
- return true;
- case 12:
- return this.underline >= -1 && this.underline < 6;
- case 13:
- return true;
- case 14:
- return this.runDirection >= -2 && this.runDirection <= 1;
- case 15:
- return this.bidiEmbedding >= -61 && this.bidiEmbedding < 62;
- case 16:
- this.justification = Math.max(0.0F, Math.min(this.justification, 1.0F));
- return true;
- case 17:
- return true;
- case 18:
- return this.imUnderline >= -1 && this.imUnderline < 6;
- case 19:
- return true;
- case 20:
- return true;
- case 21:
- return this.kerning >= 0 && this.kerning <= 1;
- case 22:
- return this.ligatures >= 0 && this.ligatures <= 1;
- case 23:
- return this.tracking >= -1.0F && this.tracking <= 10.0F;
- default:
- throw new InternalError("unknown attribute: " + var1);
- }
- }
-
- public static float getJustification(Map<?, ?> var0) {
- if (var0 != null) {
- if (var0 instanceof AttributeMap && ((AttributeMap)var0).getValues() != null) {
- return ((AttributeMap)var0).getValues().justification;
- }
-
- Object var1 = var0.get(TextAttribute.JUSTIFICATION);
- if (var1 != null && var1 instanceof Number) {
- return Math.max(0.0F, Math.min(1.0F, ((Number)var1).floatValue()));
- }
- }
-
- return DEFAULT.justification;
- }
-
- public static NumericShaper getNumericShaping(Map<?, ?> var0) {
- if (var0 != null) {
- if (var0 instanceof AttributeMap && ((AttributeMap)var0).getValues() != null) {
- return ((AttributeMap)var0).getValues().numericShaping;
- }
-
- Object var1 = var0.get(TextAttribute.NUMERIC_SHAPING);
- if (var1 != null && var1 instanceof NumericShaper) {
- return (NumericShaper)var1;
- }
- }
-
- return DEFAULT.numericShaping;
- }
-
- public AttributeValues applyIMHighlight() {
- if (this.imHighlight != null) {
- Object var1 = null;
- InputMethodHighlight var4;
- if (this.imHighlight instanceof InputMethodHighlight) {
- var4 = (InputMethodHighlight)this.imHighlight;
- } else {
- var4 = (InputMethodHighlight)((Annotation)this.imHighlight).getValue();
- }
-
- Map var2 = var4.getStyle();
- if (var2 == null) {
- Toolkit var3 = Toolkit.getDefaultToolkit();
- var2 = var3.mapInputMethodHighlight(var4);
- }
-
- if (var2 != null) {
- return this.clone().merge(var2);
- }
- }
-
- return this;
- }
-
- public static AffineTransform getBaselineTransform(Map<?, ?> var0) {
- if (var0 != null) {
- AttributeValues var1 = null;
- if (var0 instanceof AttributeMap && ((AttributeMap)var0).getValues() != null) {
- var1 = ((AttributeMap)var0).getValues();
- } else if (var0.get(TextAttribute.TRANSFORM) != null) {
- var1 = fromMap(var0);
- }
-
- if (var1 != null) {
- return var1.baselineTransform;
- }
- }
-
- return null;
- }
-
- public static AffineTransform getCharTransform(Map<?, ?> var0) {
- if (var0 != null) {
- AttributeValues var1 = null;
- if (var0 instanceof AttributeMap && ((AttributeMap)var0).getValues() != null) {
- var1 = ((AttributeMap)var0).getValues();
- } else if (var0.get(TextAttribute.TRANSFORM) != null) {
- var1 = fromMap(var0);
- }
-
- if (var1 != null) {
- return var1.charTransform;
- }
- }
-
- return null;
- }
-
- public void updateDerivedTransforms() {
- if (this.transform == null) {
- this.baselineTransform = null;
- this.charTransform = null;
- } else {
- this.charTransform = new AffineTransform(this.transform);
- this.baselineTransform = extractXRotation(this.charTransform, true);
- if (this.charTransform.isIdentity()) {
- this.charTransform = null;
- }
-
- if (this.baselineTransform.isIdentity()) {
- this.baselineTransform = null;
- }
- }
-
- if (this.baselineTransform == null) {
- this.nondefault &= ~EAttribute.EBASELINE_TRANSFORM.mask;
- } else {
- this.nondefault |= EAttribute.EBASELINE_TRANSFORM.mask;
- }
-
- }
-
- public static AffineTransform extractXRotation(AffineTransform var0, boolean var1) {
- return extractRotation(new Point2D.Double((double)1.0F, (double)0.0F), var0, var1);
- }
-
- public static AffineTransform extractYRotation(AffineTransform var0, boolean var1) {
- return extractRotation(new Point2D.Double((double)0.0F, (double)1.0F), var0, var1);
- }
-
- private static AffineTransform extractRotation(Point2D.Double var0, AffineTransform var1, boolean var2) {
- var1.deltaTransform(var0, var0);
- AffineTransform var3 = AffineTransform.getRotateInstance(var0.x, var0.y);
-
- try {
- AffineTransform var4 = var3.createInverse();
- var1.preConcatenate(var4);
- if (var2) {
- double var5 = var1.getTranslateX();
- double var7 = var1.getTranslateY();
- if (var5 != (double)0.0F || var7 != (double)0.0F) {
- var1.setTransform(var1.getScaleX(), var1.getShearY(), var1.getShearX(), var1.getScaleY(), (double)0.0F, (double)0.0F);
- var3.setTransform(var3.getScaleX(), var3.getShearY(), var3.getShearX(), var3.getScaleY(), var5, var7);
- }
- }
-
- return var3;
- } catch (NoninvertibleTransformException var9) {
- return null;
- }
- }
- }
-